Contents | Index | < Browse | Browse >
LETTERceilULETTER
Rounds floating-point numbers.
Overview
#include <math.h>
d = ceil(x);
double d; // result
double x; // floating-point number
Portability
ANSI
Description
In contrast to "floor", "ceil" rounds the specified double-precision
floating-point number to the next whole number.
Returns
This function returns the smallest whole number not less than the specified
double-precision argument.
See also
floor
Example
#include <stdio.h>
#include <math.h>
double r;
void main(void)
{
r = ceil(473.76); // r contains the number 474.0
printf("ceil(473.76) = %lf\\n", r);
}